Ext.define('TS.view.movie.movie.Grid' , {
	extend: 'TS.lib.Grid',
	alias : 'widget.moviegrid',
	tbar:Factory.toolbar.search([{
		name:'author_id',
		xtype:'combo',
		store:Dict.author,
		empty:'Autor'
	},{
		name:'language_id',
		xtype:'combo',
		store:Dict.language,
		empty:'Język'
	},{
		name:'time_min',
		searchName:'movie_length',
		searchSign:'>=',
		xtype:'text',
		empty:'Min Czas'
	},{
		name:'time_max',
		searchName:'movie_length',
		searchSign:'<=',
		xtype:'text',
		empty:'Max Czas'
	}]),
	frame:false,
	store: 'Movie',
	columns: [
	 	{xtype: 'rownumberer'},{
			header:'ID',
			hidden:true,
			dataIndex:'movie_id'
		},{
			header:'movie_title',
			sortable:true,hidden:true,
			dataIndex:'movie_title'
		},{
			header:'Opis',
			dataIndex:'movie_title',
			renderer:function(v,x,s){
				var d = s.data;
				d.movie_author_name = Factory.rend.loose_dict(s.data.author_id,Dict.author);
				d.movie_language_name = Factory.rend.loose_dict(s.data.language_id,Dict.language);
				return new Ext.XTemplate(HTML.movie.description).apply(d);
			}
		
		},{
			header:'Podgląd',
			dataIndex:'movie_source',
			//width:300,
			//fixed:true,
			align:'center',
			renderer:function(v,x,s){
				
				return s.data.movie_website_id == CONST.website.google ? 
					Ext.String.format(HTML.movie.google,v) : 
					Ext.String.format(HTML.movie.youtube,v); 
			}
		},{
			header:'movie_description',
			sortable:true,
			//hidden:true,
			renderer:Factory.rend.div,
			dataIndex:'movie_description'
		},{
			header:'movie_source',
			sortable:true,hidden:true,
			dataIndex:'movie_source'
		},{
			header:'movie_length',
			sortable:true,hidden:true,
			dataIndex:'movie_length'
		},{
			header:'language_id',
			sortable:true,hidden:true,
			renderer:Factory.rend.dict(Dict.language),
			dataIndex:'language_id'
		},{
			header:'author_id',
			sortable:true,hidden:true,
			renderer:Factory.rend.dict(Dict.author),
			dataIndex:'author_id'
		}
	]
});
